//package com.dy.nygl.service.impl;
//
//import javax.annotation.Resource;
//import javax.jms.Destination;
//import javax.jms.JMSException;
//import javax.jms.Message;
//import javax.jms.Session;
//
//import org.springframework.jms.core.JmsTemplate;
//import org.springframework.jms.core.MessageCreator;
//import org.springframework.stereotype.Service;
//
//import com.dy.nygl.service.MessageProducerService;
//
//@Service("messageProducerService")
//public class MessageProducerServiceImpl implements MessageProducerService{
//	
//	@Resource(name="jmsTemplate")
//	private JmsTemplate jmsTemplate;
//	
//	public void sendMessage(Destination destination,String msg) {
//		System.out.println("HelloWorld" + destination.toString() + "send" + msg);
//		
//		/**
//		 * 向指定队列发送消息
//		 */
//		jmsTemplate.send(destination,new MessageCreator() {		
//			public Message createMessage(Session session) throws JMSException {
//				return session.createTextMessage(msg);
//			}
//		});
//	}
//	
//	/**
//	 * 向默认队列发送消息
//	 * @param msg
//	 */
//	public void sendMessage(String msg) {
//		System.out.println("HelloWorld" + msg);
//		jmsTemplate.send(new MessageCreator() {	
//			public Message createMessage(Session session) throws JMSException {				
//				return session.createTextMessage(msg);
//			}
//		});
//	}
//}
